package com.song.secure;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Repository;

import com.song.secure.bean.User;
import com.song.secure.service.RoleService;

public class CustomUserDetailsServiceImpl implements CustomUserDetailsService {

	@Resource
	private RoleService  roleService;
	
	
	
	public RoleService getRoleService() {
		return roleService;
	}



	public void setRoleService(RoleService roleService) {
		this.roleService = roleService;
	}



	public UserDetails loadUserByUsername(String name)
			throws UsernameNotFoundException {
		
		User user = this.roleService.getUserByName(name);
		
		return user;
	}

	
}
